﻿

<%@ Page Language="C#" AutoEventWireup="false" CodeFile="UploadFile.aspx.cs" Inherits="HumanResorcesProj.GUI.Extensions.UploadFile" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Upload file</title>
</head>
<body>
    <form id="form1" runat="server">
	<asp:FileUpload runat="server" ID="ctrFile" /> <asp:Button ID="btnUploadFile" runat="server" Text="Upload" />
	<asp:HyperLink runat="server" ID="ctrResult" Target="_blank" />
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
        DataKeyNames="FileId" DataSourceID="SqlDataSource1" 
        onselectedindexchanged="GridView1_SelectedIndexChanged">
        <Columns>
            <asp:CommandField ShowSelectButton="True" />
            <asp:BoundField DataField="FileId" HeaderText="FileId" ReadOnly="True" 
                SortExpression="FileId" />
            <asp:BoundField DataField="FileName" HeaderText="FileName" 
                SortExpression="FileName" />
            <asp:BoundField DataField="FileType" HeaderText="FileType" 
                SortExpression="FileType" />
            <asp:BoundField DataField="FileSize" HeaderText="FileSize" 
                SortExpression="FileSize" />
        </Columns>
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConflictDetection="CompareAllValues" 
        ConnectionString="<%$ ConnectionStrings:Eden-DatabaseConnectionString3 %>" 
        DeleteCommand="DELETE FROM [File] WHERE [FileId] = @original_FileId AND (([FileName] = @original_FileName) OR ([FileName] IS NULL AND @original_FileName IS NULL)) AND (([FileType] = @original_FileType) OR ([FileType] IS NULL AND @original_FileType IS NULL)) AND (([FileSize] = @original_FileSize) OR ([FileSize] IS NULL AND @original_FileSize IS NULL)) AND (([FileContent] = @original_FileContent) OR ([FileContent] IS NULL AND @original_FileContent IS NULL))" 
        InsertCommand="INSERT INTO [File] ([FileId], [FileName], [FileType], [FileSize], [FileContent]) VALUES (@FileId, @FileName, @FileType, @FileSize, @FileContent)" 
        OldValuesParameterFormatString="original_{0}" 
        SelectCommand="SELECT * FROM [File]" 
        UpdateCommand="UPDATE [File] SET [FileName] = @FileName, [FileType] = @FileType, [FileSize] = @FileSize, [FileContent] = @FileContent WHERE [FileId] = @original_FileId AND (([FileName] = @original_FileName) OR ([FileName] IS NULL AND @original_FileName IS NULL)) AND (([FileType] = @original_FileType) OR ([FileType] IS NULL AND @original_FileType IS NULL)) AND (([FileSize] = @original_FileSize) OR ([FileSize] IS NULL AND @original_FileSize IS NULL)) AND (([FileContent] = @original_FileContent) OR ([FileContent] IS NULL AND @original_FileContent IS NULL))">
        <DeleteParameters>
            <asp:Parameter Name="original_FileId" Type="Object" />
            <asp:Parameter Name="original_FileName" Type="String" />
            <asp:Parameter Name="original_FileType" Type="String" />
            <asp:Parameter Name="original_FileSize" Type="Int32" />
            <asp:Parameter Name="original_FileContent" Type="Object" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="FileName" Type="String" />
            <asp:Parameter Name="FileType" Type="String" />
            <asp:Parameter Name="FileSize" Type="Int32" />
            <asp:Parameter Name="FileContent" Type="Object" />
            <asp:Parameter Name="original_FileId" Type="Object" />
            <asp:Parameter Name="original_FileName" Type="String" />
            <asp:Parameter Name="original_FileType" Type="String" />
            <asp:Parameter Name="original_FileSize" Type="Int32" />
            <asp:Parameter Name="original_FileContent" Type="Object" />
        </UpdateParameters>
        <InsertParameters>
            <asp:Parameter Name="FileId" Type="Object" />
            <asp:Parameter Name="FileName" Type="String" />
            <asp:Parameter Name="FileType" Type="String" />
            <asp:Parameter Name="FileSize" Type="Int32" />
            <asp:Parameter Name="FileContent" Type="Object" />
        </InsertParameters>
    </asp:SqlDataSource>
    </form>
</body>
</html>